import request from '@/config/axios'

// 设备借用日志 VO
export interface FacilityLogVO {
  id: number // id
  projectId: string // 项目id
  projectName: string // 项目名称
  companyName: string // 项目名称
  equipmentId: string // 设备id
  equipmentName: string // 设备名称
  calibrationEquipment: string // 校准设备
  standardValue: string // 标准值
  borrowStartTime: Date // 借用开始时间
  borrowEndTime: Date // 借用结束时间
}

// 设备借用日志 API
export const FacilityLogApi = {
  // 查询设备借用日志分页
  getFacilityLogPage: async (params: any) => {
    return await request.get({ url: `/infra/facility-log/page`, params })
  },

  // 查询设备借用日志详情
  getFacilityLog: async (id: number) => {
    return await request.get({ url: `/infra/facility-log/get?id=` + id })
  },

  // 新增设备借用日志
  createFacilityLog: async (data: any) => {
    return await request.post({ url: `/infra/facility-log/create`, data })
  },

  createLog: async (data: any) => {
    return await request.post({ url: `/infra/facility-log/createLog`, data })
  },

  // 修改设备借用日志
  updateFacilityLog: async (data: FacilityLogVO) => {
    return await request.put({ url: `/infra/facility-log/update`, data })
  },
  saveFacilityReceive: async (data: FacilityLogVO) => {
    return await request.post({ url: `/infra/facility-log/saveFacilityReceive`, data })
  },
  facilityReceiveInfo: async (id: number) => {
    return await request.get({ url: `/infra/facility-log/facilityReceiveInfo?id=` + id })
  },


  // 删除设备借用日志
  deleteFacilityLog: async (id: number) => {
    return await request.delete({ url: `/infra/facility-log/delete?id=` + id })
  },

  // 导出设备借用日志 Excel
  exportFacilityLog: async (params) => {
    return await request.download({ url: `/infra/facility-log/export-excel`, params })
  },
}
